﻿@model MasResourceSubGroup

@{
    int resGrpId = ViewBag.ResGrpId;
    var resGrp = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient().SelectResourceGroup(new MasResourceGroup{ResGrpId = resGrpId},null).FirstOrDefault();
    var resType = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient().SelectResourceType(new MasResourceType{ResTypeId = resGrp.ResTypeId.Value}, null).FirstOrDefault();
    ViewBag.CustomMenu = new Dictionary<string, string>
        {
            {
                "ประเภท" + resType.Name , Url.Action("Index", "MasResourceType")
            }, 
            {
                "หมวด" + resGrp.Name, Url.Action("Index", "MasResourceGroup", new {resTypeId=resGrp.ResTypeId})
            }, 
            {
                "กลุ่ม", Url.Action("Index", "MasResourceSubGroup", new {resGrpId = resGrp.ResGrpId})
            }
        };
    ViewBag.ResGrp = resGrp;
    ViewBag.Title = "แก้ไขกลุ่มพัสดุ";
    ViewBag.Descr = "แก้ไขข้อมูลกลุ่มพัสดุ" + (Model.Name ?? string.Empty) ;
}

@using (Html.BeginForm("Edit", "MasResourceSubGroup", FormMethod.Post, new { @class = "form-horizontal" }))
{
    @Html.AntiForgeryToken()

    <div class="block-button-menu-above">
        @Html.ButtonViewAll(new {ResGrpId = ViewBag.ResGrpId})
        @Html.ButtonSubmit()
        @Html.ButtonCancel(new { id = Model.ResGrpId, ViewBag.ResGrpId})
    </div>
    
    @Html.ValidationSummary(true, ValidateText.RequiredField, new { @class = "alert alert-error" })
    @Html.Partial("_EditorForm")
}

@section scripts
{
    <script type="text/javascript">
        $(function () {
        })
    </script>
}
